package cn.yj.cgs.dba.entity;

import cn.yj.cgs.dba.BaseEntity;
import cn.yj.commons.utils.StringUtils;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author 永健
 * @since 2021-10-10 18:54
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName(value = "tb_tuodan")
public class TuoDan extends BaseEntity {
    private String content;
    private String tuoDanCode;

    private String wechatId;

    private String userCode;
    private String avatar;

    private Integer sex;

    private String schoolName;
    private String nickName;

    /**
     * 被抽取到的次数
     */
    private long count;

    @TableLogic
    private Boolean deleted;

    private String status;

    private int payCount;

    @TableField(exist = false)
    private String images;

    @TableField(exist = false)
    private List<String> imagesList;

    public List<String> getImages() {
        return StringUtils.isNotBlank(images)?new ArrayList<>(Arrays.asList(images.split("&&"))):new ArrayList<>();
    }

}
